package com.md.api.controller;

import com.md.api.annotation.NoRepeatSubmit;
import com.md.api.common.config.RedisKeys;
import com.md.api.common.utils.RedisUtil;
import com.md.api.common.utils.StringUtils;
import com.md.api.entity.*;
import com.md.api.entity.dto.ComposeCommitDto;
import com.md.api.entity.dto.ComposeQueryDto;
import com.md.api.entity.dto.SendDto;
import com.md.api.service.*;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;




@RequestMapping("/sys")
@RestController
public class SysController {

	@Resource
	ShoppingService shoppingService;
	@Resource
	SysUserSevice sysUserSevice;
	@Resource
	UserSevice userSevice;
	@Resource
	CouponService couponService;
	@Resource
	CarService carService;
	@Resource
	RedisUtil redisUtil;

	
@NoRepeatSubmit
@RequestMapping("/index/count")
	@ResponseBody
	public HttpResult userPage() {

		return sysUserSevice.indexCount();
	}
	
@NoRepeatSubmit
@RequestMapping("/userPage")
	public HttpResult userPage( @RequestBody ComposeQueryDto composeQueryDto) {
		
		return sysUserSevice.userPage(composeQueryDto);
	}
	
@NoRepeatSubmit
@RequestMapping("/deleteUser")
	@ResponseBody
	public HttpResult deleteUser( @RequestBody ComposeCommitDto commitDto) {
	
		return sysUserSevice.deleteUser(commitDto);
	}
	
@NoRepeatSubmit
@RequestMapping("/resetPass")
	@ResponseBody
	public HttpResult resetPass( @RequestBody SysUser sysUser) {
		
		return sysUserSevice.resetPass(sysUser);
	}

	
	@NoRepeatSubmit
	@RequestMapping("/enableUser")
	@ResponseBody
	public HttpResult enableUser( @RequestBody SysUser user) {
	
		return sysUserSevice.enableUser(user);
	}

	//绑定站点
	@NoRepeatSubmit
	@RequestMapping("/bindSite")
	@ResponseBody
	public HttpResult bindSite(HttpServletRequest request, @RequestBody SysUser user) {
		if (null==user.getUserId()||StringUtils.isEmpty(user.getSiteId())){
			return HttpResult.PARAM_ERROR;
		}
		return sysUserSevice.bindSite(user);
	}
	
	@NoRepeatSubmit
	@RequestMapping("/addUser")
	@ResponseBody
	public HttpResult register( @RequestBody SysUser user) {
	
		return sysUserSevice.addUser(user);
	}

	
	@NoRepeatSubmit
	@RequestMapping("/updateUser")
	@ResponseBody
	public HttpResult updateUser( @RequestBody SysUser user) {
	
		return sysUserSevice.updateUser(user);
	}

	
	@NoRepeatSubmit
	@RequestMapping("/updatePass")
	@ResponseBody
	public HttpResult updatePass(HttpServletRequest request, @RequestBody SysUser user) {
		SysUser dbUser = (SysUser)redisUtil.get(RedisKeys.getSysUserTokenInfoKey(request.getHeader("token")));
		user.setUserId(dbUser.getUserId());
		return sysUserSevice.updatePass(user);
	}


	//解绑上下级关系
	@NoRepeatSubmit
	@RequestMapping("/unbindParent")
	@ResponseBody
	public HttpResult unbindParent(HttpServletRequest request, @RequestBody UserInfo user) {
		if (StringUtils.isEmpty(user.getUserId())){
			return HttpResult.PARAM_ERROR;
		}
		return userSevice.unbindParent(user);
	}

	
	@NoRepeatSubmit
	@RequestMapping("/login")
	public HttpResult login( @RequestBody SysUser user) {
		return sysUserSevice.sysUserLogin(user);
	}



	// -----------------------------------------------


	
@NoRepeatSubmit
@RequestMapping("/advertPage")
	public HttpResult advertPage(@RequestBody ComposeQueryDto composeQueryDto) {

		return sysUserSevice.advertPage(composeQueryDto);
	}
	
@NoRepeatSubmit
@RequestMapping("/addAdvert")
	public HttpResult addAdvert(@RequestBody AdvertisementInfo advert) {
		if (null==advert.getAdType()){
			return HttpResult.PARAM_ERROR;
		}
		return sysUserSevice.addAdvert(advert);
	}

	
@NoRepeatSubmit
@RequestMapping("/deleteAdvert")
	public HttpResult deleteEvaluation(@RequestBody AdvertisementInfo record) {
		if (null==record.getId()){
			return HttpResult.PARAM_ERROR;
		}
		return sysUserSevice.deleteAdvert(record);
	}

	
@NoRepeatSubmit
@RequestMapping("/updateAdvert")
	public HttpResult updateAdvert(@RequestBody AdvertisementInfo record) {
		if (null==record.getId()){
			return HttpResult.PARAM_ERROR;
		}
		return sysUserSevice.updateAdvert(record);
	}





	
	@NoRepeatSubmit
	@RequestMapping("/sitePage")
	public HttpResult sitePage(@RequestBody ComposeQueryDto composeQueryDto) {

		return sysUserSevice.sitePage(composeQueryDto);
	}
	
	@NoRepeatSubmit
	@RequestMapping("/addSite")
	public HttpResult addSite(@RequestBody SiteInfo siteInfo) {
		if (null==siteInfo.getLatitude()||null==siteInfo.getLongitude()){
			return HttpResult.PARAM_ERROR;
		}
		return sysUserSevice.addSite(siteInfo);
	}

	
	@NoRepeatSubmit
	@RequestMapping("/deleteSite")
	public HttpResult deleteSite(@RequestBody SiteInfo siteInfo) {
		if (StringUtils.isEmpty(siteInfo.getSiteId())){
			return HttpResult.PARAM_ERROR;
		}
		return sysUserSevice.deleteSite(siteInfo);
	}

	
	@NoRepeatSubmit
	@RequestMapping("/updateSite")
	public HttpResult updateSite(@RequestBody SiteInfo siteInfo) {
		if (StringUtils.isEmpty(siteInfo.getSiteId())){
			return HttpResult.PARAM_ERROR;
		}
		return sysUserSevice.updateSite(siteInfo);
	}



	@NoRepeatSubmit
	@RequestMapping("/siteServiceContentPage")
	public HttpResult siteServiceContentPage(@RequestBody ComposeQueryDto composeQueryDto) {
		if (StringUtils.isEmpty(composeQueryDto.getSiteId())){
			return HttpResult.PARAM_ERROR;
		}
		return sysUserSevice.siteServiceContentPage(composeQueryDto);
	}

	@NoRepeatSubmit
	@RequestMapping("/addSiteServiceContent")
	public HttpResult addSiteServiceContent(@RequestBody SiteServiceContent siteInfo) {
		if (StringUtils.isEmpty(siteInfo.getSiteId())){
			return HttpResult.PARAM_ERROR;
		}
		return sysUserSevice.addSiteServiceContent(siteInfo);
	}


	@NoRepeatSubmit
	@RequestMapping("/deleteSiteServiceContent")
	public HttpResult deleteSiteServiceContent(@RequestBody SiteServiceContent serviceContent) {
		if (StringUtils.isEmpty(serviceContent.getSiteId())
				&&StringUtils.isEmpty(serviceContent.getServiceId())){
			return HttpResult.PARAM_ERROR;
		}
		return sysUserSevice.deleteSiteServiceContent(serviceContent);
	}


	@NoRepeatSubmit
	@RequestMapping("/updateSiteServiceContent")
	public HttpResult updateSiteServiceContent(@RequestBody SiteServiceContent serviceContent) {
		if (StringUtils.isEmpty(serviceContent.getSiteId())){
			return HttpResult.PARAM_ERROR;
		}
		return sysUserSevice.updateSiteServiceContent(serviceContent);
	}






	@NoRepeatSubmit
	@RequestMapping("/carTypeList")
	public HttpResult carTypeList() {
		return carService.typeList();
	}

	@NoRepeatSubmit
	@RequestMapping("/addCarType")
	public HttpResult addCarType(@RequestBody SysCarType carType) {
		if (StringUtils.isEmpty(carType.getCarType())){
			return HttpResult.PARAM_ERROR;
		}
		return sysUserSevice.addCarType(carType);
	}


	@NoRepeatSubmit
	@RequestMapping("/deleteCarType")
	public HttpResult deleteCarType(@RequestBody SysCarType carType) {
		if (null==carType.getId()){
			return HttpResult.PARAM_ERROR;
		}
		return sysUserSevice.deleteCarType(carType);
	}








	
	@NoRepeatSubmit
	@RequestMapping("/couponPage")
	public HttpResult couponPage(@RequestBody ComposeQueryDto composeQueryDto) {

		return couponService.couponPage(composeQueryDto);
	}
	
	@NoRepeatSubmit
	@RequestMapping("/addCoupon")
	public HttpResult addCoupon(@RequestBody CouponInfo couponInfo) {
		if (null==couponInfo.getDiscount()){
			return HttpResult.PARAM_ERROR;
		}
		return couponService.addCoupon(couponInfo);
	}

	
	@NoRepeatSubmit
	@RequestMapping("/deleteCoupon")
	public HttpResult deleteCoupon(@RequestBody CouponInfo couponInfo) {
		if (null==couponInfo.getCouponId()){
			return HttpResult.PARAM_ERROR;
		}
		return couponService.deleteCoupon(couponInfo);
	}

	
	@NoRepeatSubmit
	@RequestMapping("/updateCoupon")
	public HttpResult updateCoupon(@RequestBody CouponInfo couponInfo) {
		if (null==couponInfo.getCouponId()||null==couponInfo.getDiscount()){
			return HttpResult.PARAM_ERROR;
		}
		return couponService.updateCoupon(couponInfo);
	}



	// ---------------------------------------------------
	
@NoRepeatSubmit
@RequestMapping("/shoppingSpuTypePage")
	public HttpResult shoppingSpuTypePage(@RequestBody ComposeQueryDto composeQueryDto) {

		return sysUserSevice.shoppingSpuTypePage(composeQueryDto);
	}
	
@NoRepeatSubmit
@RequestMapping("/addShoppingSpuType")
	public HttpResult addShoppingSpuType(@RequestBody ShoppingSpuType spuType) {
		return sysUserSevice.addShoppingSpuType(spuType);
	}

	
@NoRepeatSubmit
@RequestMapping("/deleteShoppingSpuType")
	public HttpResult deleteDShoppingSpuType(@RequestBody ShoppingSpuType spuType) {

		return sysUserSevice.deleteShoppingSpuType(spuType);
	}

	
@NoRepeatSubmit
@RequestMapping("/updateShoppingSpuType")
	public HttpResult updateShoppingSpuType(@RequestBody ShoppingSpuType spuType) {

		return sysUserSevice.updateShoppingSpuType(spuType);
	}

	
@NoRepeatSubmit
@RequestMapping("/newShoppingAttribute")
	public HttpResult newShoppingAttribute(@RequestBody ShoppingAttribute attribute) {

		return shoppingService.newAttribute(attribute);
	}





	
@NoRepeatSubmit
@RequestMapping("/updateShoppingAttribute")
	public HttpResult updateShoppingAttribute(@RequestBody ShoppingAttribute attribute) {

		return shoppingService.updateAttribute(attribute);
	}

	
@NoRepeatSubmit
@RequestMapping("/deleteShoppingAttribute")
	public HttpResult deleteShoppingAttribute(@RequestBody ShoppingAttribute attribute) {

		return shoppingService.deleteAttribute(attribute);
	}


	
@NoRepeatSubmit
@RequestMapping("/updateShoppingAttributeValue")
	public HttpResult updateShoppingAttributeValue(@RequestBody ShoppingAttributeValue attributeValue) {
		return shoppingService.updateAttributeValue(attributeValue);
	}

	
@NoRepeatSubmit
@RequestMapping("/deleteShoppingAttributeValue")
	public HttpResult deleteShoppingAttributeValue(@RequestBody ShoppingAttributeValue attributeValue) {
		return shoppingService.deleteAttributeValue(attributeValue);
	}


	
@NoRepeatSubmit
@RequestMapping("/shoppingAttributeList")
	public HttpResult shoppingAttributeList(@RequestBody ShoppingAttribute attribute) {
		return shoppingService.attributeList(attribute);
	}

	
@NoRepeatSubmit
@RequestMapping("/shoppingAttributeTree")
	public HttpResult shoppingAttributeTree(@RequestBody ShoppingAttribute attribute) {
		return shoppingService.attributeTree(attribute);
	}

	
@NoRepeatSubmit
@RequestMapping("/newShoppingAttributeValue")
	public HttpResult newShoppingAttributeValue(@RequestBody ShoppingAttributeValue attributeValue) {
		return shoppingService.newAttributeValue(attributeValue);
	}

	
@NoRepeatSubmit
@RequestMapping("/shoppingAttributeValueList")
	public HttpResult shoppingAttributeValueList(@RequestBody ShoppingAttributeValue attributeValue) {
		if (StringUtils.isEmpty(attributeValue.getAttributeId())){
			return HttpResult.PARAM_ERROR;
		}
		return shoppingService.attributeValueList(attributeValue.getAttributeId());
	}



	
	
@NoRepeatSubmit
@RequestMapping("/deleteShoppingProduct")
	public HttpResult deleteShoppingProduct(@RequestBody ShoppingSpu spu) {
		if (StringUtils.isEmpty(spu.getSpuId())){
			return HttpResult.PARAM_ERROR;
		}
		try {
			HttpResult result = shoppingService.deleteShoppingProduct( spu);
			return result;
		}catch (Exception e){
			e.printStackTrace();
			return HttpResult.fail("删除商品失败！");
		}
	}

	
	
@NoRepeatSubmit
@RequestMapping("/newShoppingProduct")
	public HttpResult newPShoppingroduct(@RequestBody ShoppingSpu spu) {
		if (null==spu.getType()||StringUtils.isEmpty(spu.getProductName())){
			return HttpResult.PARAM_ERROR;
		}
		try {
			HttpResult result = shoppingService.newProduct( spu);
			return result;
		}catch (Exception e){
			e.printStackTrace();
			return HttpResult.fail("新增商品失败！");
		}
	}

	//商品列表
	
@NoRepeatSubmit
@RequestMapping("/shoppingSpuPage")
	public HttpResult shoppingSpuPage(@RequestBody ComposeQueryDto composeQueryDto) {

		return sysUserSevice.shoppingSpuPage(composeQueryDto);
	}

	//产品列表
	
@NoRepeatSubmit
@RequestMapping("/shoppingSkuPage")
	public HttpResult shoppingSkuPage(@RequestBody ComposeQueryDto composeQueryDto) {
		if (StringUtils.isEmpty(composeQueryDto.getSpuId())){
			return HttpResult.PARAM_ERROR;
		}
		return sysUserSevice.shoppingSkuPage(composeQueryDto);
	}
	//产品的上架
	
	
@NoRepeatSubmit
@RequestMapping("/shoppingSkuUp")
	public HttpResult shoppingSkuUp(@RequestBody ShoppingSku sku) {
		if (StringUtils.isEmpty(sku.getSkuId())){
			return HttpResult.PARAM_ERROR;
		}
		try {
			return shoppingService.skuUp( sku);
		}catch (Exception e){
			e.printStackTrace();
			return HttpResult.fail("產品上架失敗！");
		}
	}
	//产品的下架
	
	
@NoRepeatSubmit
@RequestMapping("/shoppingSkuDown")
	public HttpResult shoppingSkuDown(@RequestBody ShoppingSku sku) {
		if (StringUtils.isEmpty(sku.getSkuId())){
			return HttpResult.PARAM_ERROR;
		}
		try {
			return shoppingService.skuDown( sku);
		}catch (Exception e){
			e.printStackTrace();
			return HttpResult.fail("產品下架失敗！");
		}
	}

	//修改商品的基本信息
	
	
@NoRepeatSubmit
@RequestMapping("/shoppingSpu/updateBase")
	public HttpResult updateShoppingSpuBase(@RequestBody ShoppingSpu spu) {
		if (StringUtils.isEmpty(spu.getSpuId())){
			return HttpResult.PARAM_ERROR;
		}
		try {
			return shoppingService.updateSpuBase(spu);
		}catch (Exception e){
			e.printStackTrace();
			return HttpResult.fail("商品修改失败！");
		}
	}

	//修改产品的基本信息
	
	
@NoRepeatSubmit
@RequestMapping("/shoppingSku/updateBase")
	public HttpResult updateShoppingSkuBase(@RequestBody ShoppingSku sku) {
		if (StringUtils.isEmpty(sku.getSkuId())){
			return HttpResult.PARAM_ERROR;
		}
		try {
			return shoppingService.updateSkuBase(sku);
		}catch (Exception e){
			e.printStackTrace();
			return HttpResult.fail("产品修改失败！");
		}
	}


	//一键设置
	
	@NoRepeatSubmit
	@RequestMapping("/onceShoppingSetting")
	public HttpResult onceShoppingSetting(@RequestBody ShoppingSku sku) {

		return shoppingService.onceShoppingSetting(sku);
	}



	@NoRepeatSubmit
	@RequestMapping("/motOrderPage")
	@ResponseBody
	public HttpResult motOrderPage( @RequestBody ComposeQueryDto composeQueryDto) {

		return sysUserSevice.motOrderPage(composeQueryDto);
	}

	@NoRepeatSubmit
	@RequestMapping("/cancelMotOrder")
	@ResponseBody
	public HttpResult cancelMotOrder( @RequestBody MotOrder order) {

		return sysUserSevice.cancelMotOrder(order);
	}

	@NoRepeatSubmit
	@RequestMapping("/motSiteOrderPage")
	@ResponseBody
	public HttpResult motSiteOrderPage( @RequestBody ComposeQueryDto composeQueryDto) {

		return sysUserSevice.motSiteOrderPage(composeQueryDto);
	}

	@NoRepeatSubmit
	@RequestMapping("/writeOffMotOrder")
	@ResponseBody
	public HttpResult writeOffMotOrder( @RequestBody MotOrder order) {
		if (StringUtils.isEmpty(order.getMotNo())){
			return HttpResult.PARAM_ERROR;
		}
		return sysUserSevice.writeOffMotOrder(order);
	}


	@NoRepeatSubmit
	@RequestMapping("/motRefundMoney")
	@ResponseBody
	public HttpResult motRefundMoney( @RequestBody ComposeCommitDto qto) {
		if (StringUtils.isEmpty(qto.getMotNo())||null==qto.getIsArrival()){
			return HttpResult.PARAM_ERROR;
		}
		return sysUserSevice.motRefundMoney(qto);
	}


	@NoRepeatSubmit
	@RequestMapping("/motReservationPage")
	@ResponseBody
	public HttpResult motReservationPage( @RequestBody ComposeQueryDto composeQueryDto) {

		return sysUserSevice.motReservationPage(composeQueryDto);
	}

	@NoRepeatSubmit
	@RequestMapping("/completeMotReservation")
	@ResponseBody
	public HttpResult completeMotReservation( @RequestBody MotReservation order) {

		return sysUserSevice.completeMotReservation(order);
	}


	// ---------------------------------------------------

	
	@NoRepeatSubmit
	@RequestMapping("/rechargeOrderPage")
	@ResponseBody
	public HttpResult rechargeOrderPage( @RequestBody ComposeQueryDto composeQueryDto) {

		return sysUserSevice.rechargeOrderPage(composeQueryDto);
	}
	@NoRepeatSubmit
	@RequestMapping("/exportMotOrder")
	@ResponseBody
	public HttpResult exportMotOrder( @RequestBody ComposeQueryDto composeQueryDto) {

		return sysUserSevice.exportMotOrder(composeQueryDto);
	}

	@NoRepeatSubmit
	@RequestMapping("/exportBalance")
	@ResponseBody
	public HttpResult exportBalance( @RequestBody ComposeQueryDto composeQueryDto) {

		return sysUserSevice.exportBalance(composeQueryDto);
	}


	
	@NoRepeatSubmit
	@RequestMapping("/shoppingOrderPage")
	@ResponseBody
	public HttpResult shoppingOrderPage( @RequestBody ComposeQueryDto composeQueryDto) {
		
		return sysUserSevice.shoppingOrderPage(composeQueryDto);
	}

	@NoRepeatSubmit
	@RequestMapping("/exportShoppingOrder")
	@ResponseBody
	public HttpResult exportShoppingOrder( @RequestBody ComposeQueryDto composeQueryDto) {

		return sysUserSevice.exportShoppingOrder(composeQueryDto);
	}
	
	@NoRepeatSubmit
	@RequestMapping("/shoppingOrderDetail")
	@ResponseBody
	public HttpResult shoppingOrderDetail( @RequestBody ShoppingOrder order) {
		if (StringUtils.isEmpty(order.getOrderNo())){
			return HttpResult.PARAM_ERROR;
		}
		return sysUserSevice.shoppingOrderDetail(order);
	}

	//分配物流相关信息
	@NoRepeatSubmit
	@RequestMapping("/distributeOrder")
	@ResponseBody
	public HttpResult distributeOrder( @RequestBody ComposeQueryDto composeQueryDto) {

		return sysUserSevice.distributeOrder(composeQueryDto);
	}


	//换货订单
	@NoRepeatSubmit
	@RequestMapping("/shoppingChangeOrderPage")
	@ResponseBody
	public HttpResult shoppingChangeOrderPage( @RequestBody ComposeQueryDto composeQueryDto) {

		return sysUserSevice.shoppingChangeOrderPage(composeQueryDto);
	}


//	//受理换货订单
//	@NoRepeatSubmit
//	@RequestMapping("/acceptedShoppingChangeOrder")
//	@ResponseBody
//	public HttpResult acceptedShoppingChangeOrder( @RequestBody ComposeCommitDto commitDto) {
//		if (StringUtils.isEmpty(commitDto.getChangeNo())){
//			return HttpResult.PARAM_ERROR;
//		}
//		return sysUserSevice.acceptedShoppingChangeOrder(commitDto);
//	}
//
//	//拒绝换货订单
//	@NoRepeatSubmit
//	@RequestMapping("/refuseedShoppingChangeOrder")
//	@ResponseBody
//	public HttpResult refuseedShoppingChangeOrder( @RequestBody ComposeCommitDto commitDto) {
//		if (StringUtils.isEmpty(commitDto.getChangeNo())){
//			return HttpResult.PARAM_ERROR;
//		}
//		return sysUserSevice.refuseedShoppingChangeOrder(commitDto);
//	}
	//确认收到换货
//	@NoRepeatSubmit
//	@RequestMapping("/confirmShoppingChangeOrder")
//	@ResponseBody
//	public HttpResult confirmShoppingChangeOrder( @RequestBody ComposeCommitDto commitDto) {
//		if (StringUtils.isEmpty(commitDto.getChangeNo())){
//			return HttpResult.PARAM_ERROR;
//		}
//		return sysUserSevice.confirmShoppingChangeOrder(commitDto);
//	}

	//填写换货物流信息
	@NoRepeatSubmit
	@RequestMapping("/fillInShoppingChangeOrder")
	@ResponseBody
	public HttpResult fillInShoppingChangeOrder( @RequestBody ShoppingChangeOrder commitDto) {
		if (StringUtils.isEmpty(commitDto.getChangeNo())||StringUtils.isEmpty(commitDto.getShippingCode())
				||StringUtils.isEmpty(commitDto.getShippingName())){
			return HttpResult.PARAM_ERROR;
		}
		return sysUserSevice.fillInShoppingChangeOrder(commitDto);
	}


	//退货订单
	@NoRepeatSubmit
	@RequestMapping("/shoppingRefundOrderPage")
	@ResponseBody
	public HttpResult shoppingRefundOrderPage( @RequestBody ComposeQueryDto composeQueryDto) {

		return sysUserSevice.shoppingRefundOrderPage(composeQueryDto);
	}

	@NoRepeatSubmit
	@RequestMapping("/exportShoppingRefundOrder")
	@ResponseBody
	public HttpResult exportShoppingRefundOrder( @RequestBody ComposeQueryDto composeQueryDto) {

		return sysUserSevice.exportShoppingRefundOrder(composeQueryDto);
	}



	//受理退货订单
	@NoRepeatSubmit
	@RequestMapping("/acceptedShoppingRefundOrder")
	@ResponseBody
	public HttpResult acceptedShoppingRefundOrder( @RequestBody ComposeQueryDto composeQueryDto) {
		if (StringUtils.isEmpty(composeQueryDto.getRefundNo())){
			return HttpResult.PARAM_ERROR;
		}
		return sysUserSevice.acceptedShoppingRefundOrder(composeQueryDto);
	}


	//受理退货订单
	
	@NoRepeatSubmit
	@RequestMapping("/refuseShoppingRefundOrder")
	@ResponseBody
	public HttpResult refuseShoppingRefundOrder( @RequestBody ComposeQueryDto composeQueryDto) {
		if (StringUtils.isEmpty(composeQueryDto.getRefundNo())){
			return HttpResult.PARAM_ERROR;
		}
		return sysUserSevice.refuseShoppingRefundOrder(composeQueryDto);
	}

	//已收到退货，执行退款
	
	@NoRepeatSubmit
	@RequestMapping("/refundShoppingMoney")
	@ResponseBody
	public HttpResult refundShoppingMoney( @RequestBody ComposeQueryDto composeQueryDto) {
		if (StringUtils.isEmpty(composeQueryDto.getRefundNo())||null==composeQueryDto.getRefundMoney()){
			return HttpResult.PARAM_ERROR;
		}
		return sysUserSevice.refundShoppingMoney(composeQueryDto);
	}



	
	@NoRepeatSubmit
	@RequestMapping("/customPage")
	@ResponseBody
	public HttpResult customPage( @RequestBody ComposeQueryDto composeQueryDto) {

		return sysUserSevice.customPage(composeQueryDto);
	}

	@RequestMapping("/getCustomNext")
	@ResponseBody
	public HttpResult getCustomNext(@RequestBody ComposeQueryDto queryDto) {
		if (StringUtils.isEmpty(queryDto.getUserId())){
			return HttpResult.PARAM_ERROR;
		}
		return sysUserSevice.getCustomNext(queryDto);
	}


	@RequestMapping("/getCustomCar")
	@ResponseBody
	public HttpResult getCustomCar(@RequestBody ComposeQueryDto queryDto) {
		if (StringUtils.isEmpty(queryDto.getUserId())){
			return HttpResult.PARAM_ERROR;
		}
		return sysUserSevice.getCustomCar(queryDto);
	}

	@NoRepeatSubmit
	@RequestMapping("/setUserType")
	@ResponseBody
	public HttpResult setUserType( @RequestBody UserInfo info) {
		if (StringUtils.isEmpty(info.getUserId())||null==info.getUserType()){
			return HttpResult.PARAM_ERROR;
		}
		return sysUserSevice.setUserType(info);
	}

	@NoRepeatSubmit
	@RequestMapping("/getAchievement")
	@ResponseBody
	public HttpResult getAchievement( @RequestBody ComposeQueryDto info) {
		if (StringUtils.isEmpty(info.getUserId())){
			return HttpResult.PARAM_ERROR;
		}
		return sysUserSevice.getAchievement(info);
	}





	//赠送积分
	@NoRepeatSubmit
	@RequestMapping("/sendPoint")
	@ResponseBody
	public HttpResult sendPoint( @RequestBody SendDto dto) {
		if (CollectionUtils.isEmpty(dto.getUserIds())){
			return HttpResult.fail("请选择要赠送的用户！");
		}
		if (null==dto.getValidityDate()
				||null==dto.getPoint()){
			return HttpResult.PARAM_ERROR;
		}
		return sysUserSevice.sendPoint(dto);
	}
	//赠送优惠券
	
	@NoRepeatSubmit
	@RequestMapping("/sendCoupon")
	@ResponseBody
	public HttpResult sendCoupon( @RequestBody SendDto dto) {
		if (CollectionUtils.isEmpty(dto.getUserIds())){
			return HttpResult.fail("请选择要赠送的用户！");
		}
		if (StringUtils.isEmpty(dto.getCouponId())){
			return HttpResult.PARAM_ERROR;
		}
		return sysUserSevice.sendCoupon(dto);
	}


	//赠送优惠券

	@NoRepeatSubmit
	@RequestMapping("/sendCouponToAllCustom")
	@ResponseBody
	public HttpResult sendCouponToAllCustom( @RequestBody SendDto dto) {
		if (StringUtils.isEmpty(dto.getCouponId())){
			return HttpResult.PARAM_ERROR;
		}
		return sysUserSevice.sendCouponToAllCustom(dto);
	}

	//赠送余额
	@NoRepeatSubmit
	@RequestMapping("/sendBalance")
	@ResponseBody
	public HttpResult sendBalance( @RequestBody SendDto dto) {
		if (CollectionUtils.isEmpty(dto.getUserIds())){
			return HttpResult.fail("请选择要赠送的用户！");
		}
		if (null==dto.getBalance()){
			return HttpResult.PARAM_ERROR;
		}
		return sysUserSevice.sendBalance(dto);
	}

	//换货订单
	@NoRepeatSubmit
	@RequestMapping("/userBalancePage")
	@ResponseBody
	public HttpResult userBalancePage( @RequestBody ComposeQueryDto composeQueryDto) {

		return sysUserSevice.userBalancePage(composeQueryDto);
	}


	//物流下拉选项
	@NoRepeatSubmit
	@RequestMapping("/findLogistics")
	@ResponseBody
	public HttpResult findLogistics(HttpServletRequest request,@RequestBody ComposeQueryDto queryDto) {
		return shoppingService.findLogistics(queryDto);
	}

	@NoRepeatSubmit
	@RequestMapping("/sysConfigList")
	public HttpResult sysConfigList() {
		return sysUserSevice.sysConfigList();
	}

	@NoRepeatSubmit
	@RequestMapping("/updateConfig")
	public HttpResult updateConfig(@RequestBody SysConfig config) {
		if (StringUtils.isEmpty(config.getConfigKey())||StringUtils.isEmpty(config.getConfigValue())){
			return HttpResult.PARAM_ERROR;
		}
		return sysUserSevice.updateConfig(config);
	}



	@NoRepeatSubmit
	@RequestMapping("/switchList")
	public HttpResult switchList() {
		return sysUserSevice.switchList();
	}


	
	@NoRepeatSubmit
	@RequestMapping("/switchOpen")
	public HttpResult switchOpen(@RequestBody SysSwitch sysSwitch) {
		return sysUserSevice.switchOpen(sysSwitch);
	}
	
	
	@NoRepeatSubmit
	@RequestMapping("/switchClose")
	public HttpResult switchClose(@RequestBody SysSwitch sysSwitch) {
		return sysUserSevice.switchClose(sysSwitch);
	}


	

	
	@NoRepeatSubmit
	@RequestMapping("/shopLocation")
	public HttpResult shopLocation() {
		return sysUserSevice.shopLocation();
	}


	
	@NoRepeatSubmit
	@RequestMapping("/setShopLocation")
	public HttpResult setShopLocation(@RequestBody ShopLocation location) {
		return sysUserSevice.setShopLocation(location);
	}


	//提现列表
	@NoRepeatSubmit
	@RequestMapping("/withdrawalPage")
	@ResponseBody
	public HttpResult withdrawalPage( @RequestBody ComposeQueryDto composeQueryDto) {

		return sysUserSevice.withdrawalPage(composeQueryDto);
	}


	//修改提现状态
	@NoRepeatSubmit
	@RequestMapping("/updateWithdrawalStatus")
	@ResponseBody
	public HttpResult updateWithdrawalStatus( @RequestBody UserWithdrawalRecord withdrawalRecord) {
		if (StringUtils.isEmpty(withdrawalRecord.getWithdrawalId())
				||null==withdrawalRecord.getStatus()||StringUtils.isEmpty(withdrawalRecord.getHandleMsg())){
			return HttpResult.PARAM_ERROR;
		}
		return sysUserSevice.updateWithdrawalStatus(withdrawalRecord);
	}


	@NoRepeatSubmit
	@RequestMapping("/firstAidPage")
	@ResponseBody
	public HttpResult firstAidPage( @RequestBody ComposeQueryDto composeQueryDto) {

		return sysUserSevice.firstAidPage(composeQueryDto);
	}


	@NoRepeatSubmit
	@RequestMapping("/carImgPage")
	@ResponseBody
	public HttpResult carImgPage( @RequestBody ComposeQueryDto composeQueryDto) {

		return sysUserSevice.carImgPage(composeQueryDto);
	}

	@NoRepeatSubmit
	@RequestMapping("/addCarImg")
	@ResponseBody
	public HttpResult addCarImg( @RequestBody CarDefaultImg logo) {

		return sysUserSevice.addCarImg(logo);
	}

	@NoRepeatSubmit
	@RequestMapping("/deleteCarImg")
	@ResponseBody
	public HttpResult deleteCarImg( @RequestBody CarDefaultImg logo) {

		return sysUserSevice.deleteCarImg(logo);
	}



	@NoRepeatSubmit
	@RequestMapping("/carLogoPage")
	@ResponseBody
	public HttpResult carLogoPage( @RequestBody ComposeQueryDto composeQueryDto) {

		return sysUserSevice.carLogoPage(composeQueryDto);
	}

	@NoRepeatSubmit
	@RequestMapping("/addCarLogo")
	@ResponseBody
	public HttpResult addCarLogo( @RequestBody CarLogo logo) {

		return sysUserSevice.addCarLogo(logo);
	}

	@NoRepeatSubmit
	@RequestMapping("/deleteCarLogo")
	@ResponseBody
	public HttpResult deleteCarLogo( @RequestBody CarLogo logo) {

		return sysUserSevice.deleteCarLogo(logo);
	}
}
